package simorg.view;

import java.util.HashMap;
import java.util.Map;

import org.dom4j.Element;

public class Flash {

	// Represents an object to be sent to the page.  This is simplistic - 
	// its a named map, and each value in the map must be a simple string.
	
	private String name;
	private Map<String, String> values;
	
	public Map<String, String> getValues() {
		return values;
	}

	public Flash(String name) {
		this.name = name;
		this.values = new HashMap<String, String>();
	}
	
	public void buildDomainXml(Element root) {
		Element flashRoot = root.addElement(this.name);
		for ( String key : this.values.keySet()) {
			Element keyElement = flashRoot.addElement(key);
			keyElement.setText(this.values.get(key));
		}
		return;
	}
}
